<!--本页面用于提供全面浏览 表Stations 的目的，同时提供链接用于能够转移到编辑及删除页面-->
<?php require("../../job/common/pdata_mysql.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>变电站编辑列表</title>
<link href="/css/alllayout.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.list { width: 100%; }
</style>
<link href="/css/allstyle.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="header"><?php include("../../job/common/header.php") ?></div>
<div id="wrap">
<?php 
	$sql1 = "select count(*) from stations where stcode like 'B%'";
	$sql2 = "select count(*) from stations where stcode like 'Q%'";
	$sql3 = "select count(*) from stations where stcode like 'C%'";
	$conn = mysql_pconnect($hostname_pdata,$username_pdata,$password_pdata);
	mysql_select_db("pdata");
	$rs1 = mysql_query($sql1,$conn) or die(mysql_error());
	$rs2 = mysql_query($sql2,$conn) or die(mysql_error());
	$rs3 = mysql_query($sql3,$conn) or die(mysql_error());
	$row1 = mysql_fetch_array($rs1);
	$row2 = mysql_fetch_array($rs2);
	$row3 = mysql_fetch_array($rs3);
	echo "<p>全部收录有院编号站数量 ".($row1[0]+$row2[0])." 个</p>";
	echo "<p>暂无院编号站数量 ".$row3[0]." 个</p>";

?>
<table border="1" class="list">
	<tr>
    	<th>代码</th>
        <th>站点编号</th>
        <th>运行名称</th>
        <th>曾用名称</th>
        <th width="80px">编辑|修改</th>
     </tr>
     
  <?php 
  $where = "";
	$sql = "select stid,stcode,stname,stoldname from stations ".$where." order by stid DESC";
	$conn = mysql_pconnect($hostname_pdata,$username_pdata,$password_pdata);
	mysql_select_db("pdata");
	$rs = mysql_query($sql,$conn) or die(mysql_error());
	while($row = mysql_fetch_array($rs))
	{
		echo "<tr>";
		echo "<td>".$row['stid']."</td>";
		echo "<td>".$row['stcode']."</td>";
		echo "<td>".$row['stname']."</td>";
		echo "<td>".$row['stoldname']."</td>";
		echo "<td align='center'>"."<a target='_new' href='st_edit.php?stid=".$row['stid']."'>编辑</a> | <a target='_new' href='st_del.php?stid=".$row['stid']."'>删除</a>"."</td>";
		echo "</tr>";
	}
	mysql_close($conn);

?>
</table>
</div>
<div id="footer"><?php include("../../job/common/footer.php") ?></div>
</body>
</html>